<?php $__env->startSection("content"); ?>
<body>
<link rel="stylesheet" href="<?php echo e(asset("admin")); ?>/lib/jq-module/zyupload/zyupload-1.0.0.min.css" media="all">
<div class="layuimini-main">

    <div class="layui-form layuimini-form">
        <?php echo e(csrf_field()); ?>

        <div class="layui-form-item">
            <label class="layui-form-label required">分类标题</label>
            <div class="layui-input-block">
                <input type="text" name="cate_name" lay-verify="required" lay-reqtext="分类标题不能为空" placeholder="请输入分类标题" value="<?php echo e($cate->cate_name); ?>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">排序</label>
            <div class="layui-input-block">
                <input type="number" name="cate_sort" placeholder="请输入1-100" min="1" max="100" value="<?php echo e($cate->cate_sort); ?>" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </div>
</div>
<script src="<?php echo e(asset("admin")); ?>/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="<?php echo e(asset("admin")); ?>/lib/jq-module/zyupload/zyupload-1.0.0.min.js" charset="utf-8"></script>
<script>

    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
           var datas =  data.field;

           $.ajaxSetup({
              header:{"X-CSRF-TOKEN":'<?php echo e(csrf_token()); ?>'}
           });
           $.ajax({
              type:'put',
              url:'/admin/category/'+ "<?php echo e($cate->id); ?>",
              data:datas,
              success:function (res) {
                  if(res.status==200){
                      layer.msg(res.msg,function () {
                          var index = parent.layer.getFrameIndex(window.name); // 获取当前窗口的索引
                          parent.layer.close(index); // 关闭当前窗口
                          parent.location.reload();
                      });
                  }else {
                      layer.msg(res.msg);
                  }
              }
           });
           return false;
        });

    });
</script>
</body>
<?php $__env->stopSection(); ?>

<?php echo $__env->make("layout.base", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/jdl/Desktop/黑马/laravelApi/resources/views/admin/category/edit.blade.php ENDPATH**/ ?>